package com.atguigu.srb.core.controller.admin;

import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "会员登录日志接口")
@RestController
@RequestMapping("/admin/core/userLoginRecord")
@Slf4j
//@CrossOrigin
public class AdminUserLoginRecordController {
      @Resource
    UserLoginRecordService userLoginRecordService;

      @GetMapping("/listTop/{userId}")
      @ApiOperation("获取用户登录信息")
      public R listTop(
              @ApiParam(value = "用户ID",required = true)
              @PathVariable("userId") Long userId){
     List<UserLoginRecord> userLoginRecordList= userLoginRecordService.listTop(userId);
        return  R.ok().data("list",userLoginRecordList);
      }

}
